{{extend "layout.html"}}

{{block css}}
<link href="{{=url_for_static('sb-admin-v2/css/plugins/dataTables/dataTables.bootstrap.css')}}" rel="stylesheet">
{{end}}

{{block breadnav}}
<li class="active">Home</li>
{{end}}

{{block content}}
<div class="row">
    <div class="col-lg-2">
        <select id="sel-project" class="form-control">
            <option value="{{=p_default.id}}">{{=p_default.name}}</option>
            {{for p in projects:}}
            <option value="{{=p.id}}">{{=p.name}}</option>
            {{pass}}
        </select>
    </div>
    
    <div class="col-lg-4">
        <div class="input-group">
            <input type="text" class="form-control cj-validator" id="txt-bug-id" cj-place="top" cj-required cj-digit cj-name="BUG ID" placeholder="只能根据 BUG 的 ID 来检索">
            <span class="input-group-btn">
                <button class="btn btn-default" type="button" id="btn-search">
                    <span class="glyphicon glyphicon-search"></span> 检索</button>
            </span>
        </div><!-- /input-group -->
    </div>
    
    <div class="col-lg-6">
        <button class="btn btn-info pull-right" id="btn-create-bug" type="button">
            <i class="fa fa-bug fa-fw"></i> 创建 BUG</button>
        
    </div>
</div>
<hr>
<div class="row">
    <div class="col-lg-6">
        <div class="col-lg-12">
            <div class="panel panel-danger">
                <div class="panel-heading">等我对应的 <b>BUG</b></div>
                <div class="panel-body">
                    <table class="table table-striped table-bordered table-hover" id="dt-assigning-bugs">
                        <thead>
                            <tr>
                                <th>#ID</th>
                                <th>bug标题</th>
                                <th>更新时间</th>
                                <th>创建者</th>
                            </tr>
                        </thead>
                        <tbody>
                        </tbody>
                    </table>
                </div> <!-- panel-body -->
            </div>     <!-- panel panel-danger -->
        </div>         <!-- col-lg-12 -->
        
        <div class="col-lg-12">
            <div class="panel panel-warning">
                <div class="panel-heading">等我确认的 <b>BUG</b></div>
                <div class="panel-body">
                    <table class="table table-striped table-bordered table-hover" id="dt-confirming-bugs">
                        <thead>
                            <tr>
                                <th>#ID</th>
                                <th>bug标题</th>
                                <th>更新时间</th>
                                <th>对应者</th>
                            </tr>
                        </thead>
                        <tbody>
                        </tbody>
                    </table>
                </div> <!-- panel-body -->
            </div>     <!-- panel panel-warning -->
        </div>         <!-- col-lg-12 -->
    </div>             <!-- col-lg-6 -->
    
    <div class="col-lg-6">
        <div class="col-lg-12">
            <div class="panel panel-info">
                <div class="panel-heading">我创建的 <b>BUG</b></div>
                <div class="panel-body">
                    <table class="table table-striped table-bordered table-hover" id="dt-created-bugs">
                        <thead>
                            <tr>
                                <th>#ID</th>
                                <th>bug标题</th>
                                <th>更新时间</th>
                                <th>当前状态</th>
                            </tr>
                        </thead>
                        <tbody>
                        </tbody>
                    </table>
                </div> <!-- panel-body -->
            </div>     <!-- panel panel-info -->
        </div>         <!-- col-lg-12 -->
        
        <div class="col-lg-12">
            <div class="panel panel-success">
                <div class="panel-heading">我已确认的 <b>BUG</b></div>
                <div class="panel-body">
                    <table class="table table-striped table-bordered table-hover" id="dt-confirmed-bugs">
                        <thead>
                            <tr>
                                <th>#ID</th>
                                <th>bug标题</th>
                                <th>更新时间</th>
                            </tr>
                        </thead>
                        <tbody>
                        </tbody>
                    </table>
                </div> <!-- panel-body -->
            </div>     <!-- panel panel-success -->
        </div>         <!-- col-lg-12 -->
    </div>             <!-- col-lg-6 -->
</div>                 <!-- row -->
{{end}}

{{block js}}
<script src="{{=url_for_static('chujue-js/chujue_validate.js')}}"></script>
<script src="{{=url_for_static('chujue-js/chujue_ajax.js')}}"></script>

<script src="{{=url_for_static('sb-admin-v2/js/plugins/dataTables/jquery.dataTables.js')}}"></script>
<script src="{{=url_for_static('sb-admin-v2/js/plugins/dataTables/dataTables.bootstrap.js')}}"></script>

<script src="{{=url_for_static('views_bug/list.js')}}"></script>
<script type="text/javascript">
    $(function(){
        init_datatbles();
        
        $("#btn-create-bug").click(function(){
            var proj_id = $("#sel-project").val();
            location.href = "/bug/edit/" + proj_id + "/0";
        });
        
        $("#sel-project").change(change_project);
        $("#btn-search").click(search_bug);
    });
</script>
{{end}}
